package com.itheima.work;

import com.itheima.utils.ConnectionUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

/**
 * @Auther LCSlove
 * @Date 2021-09-06 14:36
 */
public class Producer {
    public static void main(String[] args) throws Exception {
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();
        channel.queueDeclare("work_queue1", true, false, false, null);
        for (int i = 0; i < 20; i++) {
            String message = "hello world,work!!!" + i;
            channel.basicPublish("", "work_queue1", null, message.getBytes());
        }
        channel.close();
        connection.close();
    }
}
